import "package:ct_pa_majordomo/config/theme_vars.dart";
import "package:flutter/cupertino.dart";
import "package:flutter/material.dart";

class ListItem extends StatelessWidget {
  final void Function()? onTap;
  final Map faceInfo;
  const ListItem({super.key, this.onTap, required this.faceInfo});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      behavior: HitTestBehavior.opaque,
      onTap: () {
        if (onTap != null) onTap!();
      },
      child: Container(
        padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 12),
        decoration: const BoxDecoration(
          borderRadius: BorderRadius.all(Radius.circular(5)),
          color: Colors.white,
        ),
        child: Row(
          children: [
            const DecoratedBox(
              decoration: BoxDecoration(
                color: ThemeVars.colorBackground,
                borderRadius: BorderRadius.all(Radius.circular(50)),
              ),
              child: Icon(Icons.person, size: 40, color: ThemeVars.colorTextTer,),
            ),
            SizedBox(width: 10,),
            Expanded(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        Text(faceInfo["name"], style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),),
                        Text("待修改", style: TextStyle(fontSize: 12, color: ThemeVars.colorError),),
                      ],
                    ),
                    SizedBox(height: 4,),
                    Row(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        Text("2023.02.25 21:32 - 2023.03.25 23:59", style: TextStyle(color: ThemeVars.colorTextTer, fontSize: 12),),
                        SizedBox(width: 10,),
                        Text("限时", style: TextStyle(color: ThemeVars.colorTextTer, fontSize: 12),),
                      ],
                    )
                  ],
                )
            )
          ],
        ),
      ),
    );
  }

}